<html>
    <head>
        <#include "/${system}/component/html-head.ftl" />
        <link rel="stylesheet" href="/${system}/editor.md/css/editormd.min.css" />
    </head>
    <body>
        <#include "/${system}/component/head.ftl" />
        <div class="admin">
            <div class="aleft" id="left-container"></div>
            <div class="aright">
                <fieldset class="layui-elem-field layui-field-title" style="margin: 20px 30px 20px 20px;">
                    <legend>修改文章</legend>
                </fieldset>
                <form class="layui-form bform">
                    <div id="content-cnt"></div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="blogEidt">立即提交</button>
                            <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <script src="${base}/${system}/js/jquery.min.js"></script>
        <script src="${base}/${system}/editor.md/editormd.min.js"></script> 
        <script>
            layui.config({base:'${base}/${system}/js/'}).use('blog-edit');
        </script>
        <script id ="template" type="text/template">
            <div class="layui-form-item">
                <label class="layui-form-label">文章标题</label>
                <div class="layui-input-block">
                    <input type="text" value="{{d.blog.name}}" name="name" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
                </div>
            </div>
            <input type="hidden" name="id" value="{{d.blog.id}}"/>
            <div class="layui-form-item" style="width: 300px;">
                <label class="layui-form-label">所属分类</label>
                <div class="layui-input-block" id="category">
                    <select name="categoryID">
                        {{#  layui.each(d.categorys, function(index, item){ }}
                            {{# if(item.id == d.blog.categoryID) { }}
                                <option value="{{item.id}}" selected>{{item.name}}</option>
                            {{# } else { }}
                                <option value="{{item.id}}">{{item.name}}</option>
                            {{# } }}
                        {{# });}}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章作者</label>
                <div class="layui-input-block">
                    <input type="text" value="{{d.blog.author}}" name="author" required lay-verify="required"  placeholder="请输入内容" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">缩略图</label>
                <div class="layui-input-block">
                    <input type="hidden" value="{{d.blog.picture}}" name="picture" id="blog-cover"/>
                    <input type="file" name="image" id="blog-cover-file" class="layui-upload-file"/>
                </div>
            </div>
            <div class="layui-form-item" id="cover-preview-cnt">
                <label class="layui-form-label"></label>
                <div>
                    {{# if(d.blog.picture) { }} 
                        <img src="{{d.blog.picture}}" id="cover-preview-img" class="blog-report-cover"/>
                    {{# } else { }}
                        <img id="cover-preview-img" class="blog-report-cover"/>
                    {{# } }}
                </div>
            </div>
            <!--<div class="layui-form-item">
                <label class="layui-form-label">关键字</label>
                <div class="layui-input-block">
                    <input type="text" name="keywords" placeholder="请输入内容" autocomplete="off" class="layui-input">
                </div>
            </div>-->
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">文章摘要</label>
                <div class="layui-input-block">
                    <textarea name="summary" required lay-verify="required"  placeholder="请输入内容" class="layui-textarea">{{d.blog.summary}}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">文章内容</label>
                <div class="layui-input-block">
                    <div id="publish-editormd"></div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">保存方式</label>
                <div class="layui-input-block">
                  <select name="status" lay-filter="aihao">
                    <option value=""></option>
                    <option value="0" selected="">发表</option>
                    <option value="1">草稿</option>
                  </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章标签</label>
                <div class="layui-input-block">
                  <input type="text" value="{{d.blog.tags}}" name="tags" required lay-verify="required"  placeholder="请输入内容" autocomplete="off" class="layui-input">
                </div>
            </div>
            <hr>
        </script>
    </body>
</html>